# Example code for (GY-521) MPU6050 Accelerometer/Gyro Module
# Write in MicroPython by Warayut Poomiwatracanont JAN 2023




from machine import Pin,I2C
from time import sleep_ms

from imu import MPU6050




i2c = I2C (0, sda=Pin (16), scl=Pin (17), freq=400000)

imu = MPU6050(i2c)


while True:
    ax=round(imu.accel.x,2)

    ay=round(imu.accel.y,2)

    az=round(imu.accel.z,2)

    gx=round(imu.gyro.x)

    gy=round(imu.gyro.y)

    gz=round(imu.gyro.z)

    print("Accel: ",ax,ay,az,"Gyro: ",gx,gy,gz)

    sleep_ms(100)